package com.proxy.daijia.customer.controller;

import com.proxy.daijia.common.result.Result;
import com.proxy.daijia.customer.service.CustomerInfoService;
import com.proxy.daijia.model.vo.customer.CustomerInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/customer/info")
@SuppressWarnings({"unchecked", "rawtypes"})
public class CustomerInfoController {

	@Autowired
	private CustomerInfoService customerInfoService;

	@Operation(summary = "获取登录信息")
	@GetMapping("/getCustomerInfo/{customerId}")
	public Result<CustomerInfoVo> getCustomerInfoVo(@PathVariable Long customerId) {
		return Result.ok(customerInfoService.getCustomerInfoVo(customerId));
	}

	@Operation(summary = "微信小程序登录")
	@GetMapping("/login/{code}")
	public Result<Long> login(@PathVariable String code) {
		return Result.ok(customerInfoService.login(code));
	}

}

